home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Sleep Deprivation 1.0 Source / Sleep Deprivation ƒ / sd wipes ƒ / BoxIn wipe.c next >
Encoding:
C/C++ Source or Header  |  1993-11-12  |  2.5 KB  |  80 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        BoxIn wipe.c
  4.  
  5. Purpose:    This module handles clearing the screen in a funky
  6.             manner.  See the comments below for more details.
  7.             
  8.  
  9. Sleep Deprivation -- graphic effects on sleep
  10. Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 3
  32.  
  33. void BoxInWipe(GrafPtr, Pattern*);
  34.  
  35. /* Basically, there are four bars -- one starts at the top and moves down;
  36.    one starts at the bottom and moves up; one starts at the left and moves
  37.    right; one starts at the right and moves left.  There's a lot of overlap
  38.    of bitcopying, but it's masked by the timing correction */
  39.    
  40. void BoxInWipe(GrafPtr thePtr, Pattern *thePattern)
  41. {
  42.     Rect        vsource1,vsource2, hsource1, hsource2;
  43.     int            vbar,hbar;
  44.     int            width,height;
  45.     int            VBarGap, HBarGap;
  46.     
  47.     width=thePtr->portRect.right-thePtr->portRect.left;
  48.     height=thePtr->portRect.bottom-thePtr->portRect.top;
  49.     
  50.     VBarGap=10;
  51.     HBarGap=VBarGap*height/width;
  52.     
  53.     vbar=0;
  54.     hbar=0;
  55.     vsource1.top=vsource2.top=hsource2.left=hsource1.left=0;    /* these */
  56.     vsource1.bottom=vsource2.bottom=height;                        /* never */
  57.     hsource1.right=hsource2.right=width;                        /* change */
  58.     while (vbar<width/2+VBarGap)
  59.     {
  60.         StartTiming();
  61.         vsource1.left=vbar;
  62.         vsource1.right=vsource1.left+VBarGap;
  63.         vsource2.right=width-vbar;
  64.         vsource2.left=vsource2.right-VBarGap;
  65.         hsource1.top=hbar;
  66.         hsource1.bottom=hsource1.top+HBarGap;
  67.         hsource2.bottom=height-hbar;
  68.         hsource2.top=hsource2.bottom-HBarGap;
  69.  
  70.         FillRect(&vsource1, *thePattern);
  71.         FillRect(&hsource1, *thePattern);
  72.         FillRect(&vsource2, *thePattern);
  73.         FillRect(&hsource2, *thePattern);
  74.  
  75.         vbar+=VBarGap;
  76.         hbar+=HBarGap;
  77.         TimeCorrection(CorrectTime);
  78.     }
  79. }
  80.